package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.BJDaflgl;
import com.ruoyi.system.service.IBJDaflglService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 分类大纲管理Controller
 * 
 * @author ruoyi
 * @date 2023-09-23
 */
@RestController
@RequestMapping("/system/daflgl")
public class BJDaflglController extends BaseController
{
    @Autowired
    private IBJDaflglService bJDaflglService;

    /**
     * 查询分类大纲管理列表
     */
//    //@PreAuthorize("@ss.hasPermi('system:daflgl:list')")
    @GetMapping("/list")
    public AjaxResult list(BJDaflgl bJDaflgl)
    {
        List<BJDaflgl> list = bJDaflglService.selectBJDaflglList(bJDaflgl);
        return success(list);
    }

    /**
     * 导出分类大纲管理列表
     */
//    //@PreAuthorize("@ss.hasPermi('system:daflgl:export')")
    @Log(title = "分类大纲管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BJDaflgl bJDaflgl)
    {
        List<BJDaflgl> list = bJDaflglService.selectBJDaflglList(bJDaflgl);
        ExcelUtil<BJDaflgl> util = new ExcelUtil<BJDaflgl>(BJDaflgl.class);
        util.exportExcel(response, list, "分类大纲管理数据");
    }

    /**
     * 获取分类大纲管理详细信息
     */
//    //@PreAuthorize("@ss.hasPermi('system:daflgl:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bJDaflglService.selectBJDaflglById(id));
    }

    /**
     * 新增分类大纲管理
     */
//    //@PreAuthorize("@ss.hasPermi('system:daflgl:add')")
    @Log(title = "分类大纲管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BJDaflgl bJDaflgl)
    {
        return toAjax(bJDaflglService.insertBJDaflgl(bJDaflgl));
    }

    /**
     * 修改分类大纲管理
     */
//    //@PreAuthorize("@ss.hasPermi('system:daflgl:edit')")
    @Log(title = "分类大纲管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BJDaflgl bJDaflgl)
    {
        return toAjax(bJDaflglService.updateBJDaflgl(bJDaflgl));
    }

    /**
     * 删除分类大纲管理
     */
//    //@PreAuthorize("@ss.hasPermi('system:daflgl:remove')")
    @Log(title = "分类大纲管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bJDaflglService.deleteBJDaflglByIds(ids));
    }
}
